#!/bin/bash
SOURCE="$0"
while [ -h "$SOURCE"  ]; do
    DIR="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"
    SOURCE="$(readlink "$SOURCE")"
    [[ $SOURCE != /*  ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE"  )" && pwd  )"

COMPILE_DATE="`date +%Y.%m.%d`"
COMPILE_MARK=v$COMPILE_DATE
echo $COMPILE_MARK > $DIR/base-files/files/etc/buildmark
echo Compile mark set to $COMPILE_MARK

LV=$(cat $DIR/lean/default-settings/files/zzz-default-settings | grep 'DISTRIB_REVISION=' | head -n 1 | cut -d "'" -f 2)
sed -i "s/^.*%D.*$/ HomeLede $COMPILE_MARK based on %D $LV/g" $DIR/base-files/files/etc/banner
echo Banner updated to
cat $DIR/base-files/files/etc/banner
